package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-23
 * Time: 11:35
 */
class MyThread extends  Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("这是我的线程，正在工作");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class ThreadDemo4 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new MyThread();
        //t.run();
        t.start();
        while (true) {
            System.out.println("这是主线程，正在工作");
            Thread.sleep(1000);
        }
    }
}
